package com.algorithm.string_and_array;

import lombok.extern.slf4j.Slf4j;
import org.junit.jupiter.api.Test;

import java.util.*;

@Slf4j
public class ArraySolutionLC09 {
    public void setZeroes(int[][] matrix) {
        Set<Integer> x = new HashSet<>();
        Set<Integer> y = new HashSet<>();
        for (int i = 0; i < matrix.length; i++) {
            int ki = -1;
            int kj = -1;
            for (int j = 0; j < matrix[i].length; j++) {
                if (matrix[i][j] == 0) {
                    int [] a = new int[2];
                    x.add(i);
                    y.add(j);
                }
            }
        }

        x.stream().forEach(v->{
            for (int i = 0; i <matrix[v].length ; i++) {
                matrix[v][i] = 0;
            }
        });

        y.stream().forEach(v->{
            for (int i = 0; i <matrix.length ; i++) {
                matrix[i][v] = 0;
            }
        });

        log.info("test");
    }

    @Test
    public void test(){
        int [][] matrix = {
                            {1,0,2,0},
                            {3,4,0,2},
                            {1,3,1,5}
                        };
        setZeroes(matrix);
        log.info("this is ");



    }
}
